Skip to content

Conversation

@dicej
Copy link
Collaborator

@dicej dicej commented Apr 15, 2025

Previously, it was possible to drop an input-stream, output-stream, or future-incoming-response while it still had an undropped child pollable given that spin-executor provided no way to cancel a pollable previously registered using push_waker. In addition, it was possible to unintentionally register more than one pollable for such a resource concurrently.

This commit adds a CancelToken return value to push_waker, which may be used to explicitly cancel the registration and immediately drop the pollable. We now use that, along with CancelOnDropToken, to ensure that we cancel any previous registration before creating a new one, as well as guarantee that the registration is cancelled before attempting to drop the parent resource.

Previously, it was possible to drop an `input-stream`, `output-stream`, or
`future-incoming-response` while it still had an undropped child `pollable`
given that `spin-executor` provided no way to cancel a `pollable` previously
registered using `push_waker`.  In addition, it was possible to unintentionally
register more than one pollable for such a resource concurrently.

This commit adds a `CancelToken` return value to `push_waker`, which may be used
to explicitly cancel the registration and immediately drop the `pollable`.  We
now use that, along with `CancelOnDropToken`, to ensure that we cancel any
previous registration before creating a new one, as well as guarantee that the
registration is cancelled before attempting to drop the parent resource.

Signed-off-by: Joel Dice <[email protected]>
Copy link
Member

@radu-matei radu-matei left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested this in my scenario that was failing and things look good!

Thank you!

LGTM

@dicej dicej merged commit 73d9a6b into spinframework:main Apr 15, 2025
3 checks passed
@dicej dicej deleted the resource-has-children-fix branch April 15, 2025 16:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants